package ldh.im.fxgui.pojo;

import ldh.im.fxbase.data.pojo.ImGroup;
import ldh.im.fxbase.data.pojo.ImUser;

public class GroupUserItem {

    private ImGroup imGroup;
    private ImUser imUser;

    public GroupUserItem(ImGroup imGroup) {
        this.imGroup = imGroup;
    }

    public GroupUserItem(ImUser imUser) {
        this.imUser = imUser;
    }

    public ImGroup getImGroup() {
        return imGroup;
    }

    public void setImGroup(ImGroup imGroup) {
        this.imGroup = imGroup;
    }

    public ImUser getImUser() {
        return imUser;
    }

    public void setImUser(ImUser imUser) {
        this.imUser = imUser;
    }

    public String getName() {
        if (imGroup != null) {
            int size = imGroup.getGroupUserSet() != null ? imGroup.getGroupUserSet().size() : 0;
            return String.format("%s(%s)", imGroup.getName(), size);
        }
        return imUser.getUserName();
    }

}
